package com.netease.nie.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.netease.nie.dao.RobGoodsInfoDao;
import com.netease.nie.dao.RobGoodsInfoPeriodDao;
import com.netease.nie.dto.RobGoodsCurrPeriodConfigDto;
import com.netease.nie.model.RobGoodsInfo;
import com.netease.nie.model.RobGoodsInfoPeriod;

@Service
public class RobGoodsCurrPeriodInfoConfigServiceImpl implements RobGoodsCurrPeriodInfoConfigService {

	@Resource
	private RobGoodsInfoDao robGoodsInfoDao;
	
	@Resource
	private RobGoodsInfoPeriodDao robGoodsInfoPeriodDao;
	
	public RobGoodsCurrPeriodConfigDto queryRobGoodsCurrPeriodConfigDtoByCondition(
			int robGoodsId, int displayPeriod) {
		RobGoodsCurrPeriodConfigDto robGoodsCurrPeriodConfigDto = new RobGoodsCurrPeriodConfigDto();
		RobGoodsInfo robGoodsInfo = robGoodsInfoDao.queryRobGoodsInfoByRobGoodsId(robGoodsId);
		RobGoodsInfoPeriod robGoodsInfoPeriod = robGoodsInfoPeriodDao.queryRobGoodsInfoPeriodByDisplayPeriod(displayPeriod);
		robGoodsCurrPeriodConfigDto.setDisplayPeriod(displayPeriod);
		robGoodsCurrPeriodConfigDto.setEachPrice(robGoodsInfo.getEachPrice());
		robGoodsCurrPeriodConfigDto.setEnded(robGoodsInfoPeriod.getEnded());
		robGoodsCurrPeriodConfigDto.setEndTime(robGoodsInfoPeriod.getEndTime());
		robGoodsCurrPeriodConfigDto.setGoodsId(robGoodsInfo.getGoodsId());
		robGoodsCurrPeriodConfigDto.setGoodsType(robGoodsInfo.getGoodsType());
		robGoodsCurrPeriodConfigDto.setPeriodId(robGoodsInfoPeriod.getId());
		robGoodsCurrPeriodConfigDto.setPublished(robGoodsInfoPeriod.getPublished());
		robGoodsCurrPeriodConfigDto.setPutOnStatus(robGoodsInfo.getPutOnStatus());
		robGoodsCurrPeriodConfigDto.setRobGoodsId(robGoodsId);
		robGoodsCurrPeriodConfigDto.setRobObjectId(robGoodsInfo.getRobObjectId());
		robGoodsCurrPeriodConfigDto.setRobTitle(robGoodsInfo.getTitle());
		robGoodsCurrPeriodConfigDto.setStartTime(robGoodsInfoPeriod.getStartTime());
		robGoodsCurrPeriodConfigDto.setTotalPt(robGoodsInfoPeriod.getTotalPt());
		return robGoodsCurrPeriodConfigDto;
	}
	

}
